<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@include file="/view/main/stylesheet.jsp"%>
<script src="${baseurl}/styles/frameword/js/jquery.validate.min.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="${baseurl}/styles/frameword/css/add.css" />
<script src="${baseurl}/styles/frameword/js/validate.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	$(function() {
		$("#close-button").click(function() {
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
		});
		var url =  "/pro-user-banner/";
		var rules = {
			name : {
				required : true
			},
			password : {
				required : true
			},
		};
		validate("form1", rules, call)
		function call(param, form) {
			if (param.imageUrl == "") {
				layer.msg('请选择Banner图');
				return;
			}
			$.post(baseUrl + url + "update", param, function(data) {
				if (data.success) {
					window.location.href = baseUrl + '/result/success';
				} else {
					window.location.href = baseUrl + '/result/failure';
				}
			});
		}
		layui.use('upload', function() {
			layui.upload({
				elem : '#cWebThumUrl',
				url : uploadImgUrl,
				before : function(input) {
					$("#iWebThumUrl").show();
					$("#spanWebThumUrl").attr("href", '');
					$("#imageUrl").val('');
				},
				success : function(res) {
					$("#imageUrl").val(res.data);
					$("#iWebThumUrl").hide();
					$("#spanWebThumUrl").attr("href", res.data);
					$("#spanWebThumUrl").text("预览图片");
				}
			});
		});
	})
</script>
</head>
<body>
<table class="table noline" style="margin-bottom: 0px;">
		<tbody>
			<tr>
				<td>
					<div class="input-group">
						<span class="input-group-addon explain">Banner图</span> <input lay-ext="png" lay-title="上传图片" id="cWebThumUrl" type="file" name="file" class="layui-upload-file"> &nbsp;<i id="iWebThumUrl" style="display: none;" class="layui-icon layui-anim layui-anim-rotate layui-anim-loop">&#xe63d;</i><a target="_blank" href="${info.imageUrl}" id="spanWebThumUrl">预览图片</a>
					</div>
				</td>
			</tr>
		<tbody>
	</table>
	<form class="bs-example bs-example-form" role="form" id="form1">
	 	<input type="hidden" name="imageUrl" id="imageUrl" value="${info.imageUrl}">
		<input type="hidden" name="primaryKey" value="${info.primaryKey}">
		<table class="table noline">
			<tbody>
				<tr>
					<td>
						<div class="input-group">
							<span class="input-group-addon explain">banner名称</span>
							<input type="text" name="name"  value="${info.name}" class="form-control">
						</div>
					</td>
					<td>
						<div class="input-group">
							<span class="input-group-addon explain">跳转地址</span>
							<input type="text" name="jumpUrl"  value="${info.jumpUrl}" class="form-control">
						</div>
					</td>
				</tr>
				<tr>
					<td colspan="2" style="text-align: right;">
						<div class="btn-group">
							<button type="button" class="btn btn-info" id="close-button">
								<i class="glyphicon glyphicon-remove"></i>
								取消
							</button>
							<button type="submit" class="btn btn-success">
								<i class="glyphicon glyphicon-ok"></i>
								修改
							</button>
						</div>
					</td>
				</tr>
			</tbody>
		</table>
	</form>

</body>

</html>